import java.util.Stack;
//包含main的函数
public class Solution1 {
    public Stack<Integer> Stack;
    public Stack<Integer> MinStack;
    public Solution1() {
        this.Stack = new Stack<>();
        this.MinStack = new Stack<>();
    }
    public void push(int node) {
        Stack.push(node);
        if(!MinStack.empty()) {
            int a = MinStack.peek();
            if(node <= a) {
                MinStack.push(node);
            }
        } else {
            MinStack.push(node);
        }
    }

    public void pop() {
        int a = Stack.peek();
        Stack.pop();
        if(a == MinStack.peek()) {
            MinStack.pop();
        }
    }

    public int top() {
        return Stack.peek();
    }

    public int min() {
        return MinStack.peek();
    }
}
